/*
 * @Author: zhangxin 411020991@qq.com
 * @Date: 2023-04-19 10:12:37
 * @LastEditors: zhangxin 411020991@qq.com
 * @LastEditTime: 2023-04-21 10:28:30
 * @FilePath: \main\src\components\HeaderNav\index.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React, { useMemo, useState } from 'react'
import { DownOutlined } from '@ant-design/icons';
import { Dropdown, Space } from 'antd';
import { history } from '@umijs/max';
const items = [
    {
        label: '个人门户',
        key: '/home',
    },
    {
        label: '租户门户',
        key: '/welcome',
    },
    {
        label: '供应商门户',
        key: '/supplierportal',
    },
];

const index = () => {
    const [mentText, setMenuText] = useState('0')
    const onClick = (e) => {
        setMenuText(e.key)
        history.push(e.key)
    }
    const demo = useMemo(() => {
        switch (mentText) {
            case '/home':
                return '个人门户'
                break;
            case '/welcome':
                return '租户门户'
                break;
            case '/supplierportal':
                return '供应商门户'
                break;
            default:
                return '个人门户'
                break;
        }
    }, [mentText])
    localStorage.nav=demo
    return (
        <Dropdown
            menu={{
                items,
                onClick: onClick
            }}
        >
           
                <Space>
                    <span style={{color:'#2979ff'}}>{demo}</span>
                    <DownOutlined />
                </Space>
        
        </Dropdown>
    )
}

export default index